with open("F:/w模式.txt","w",encoding="UTF-8") as f:
    f.write("hello")
    f.flush()
with open("F:/a模式.txt","a",encoding="UTF-8") as f:
    f.write("hello\n")
    f.flush()